package logbean;
import java.sql.*;
import java.util.*;


public class Data_Base_Connection{
		
	public Connection conn=null;
	public Statement st=null;

	String url = "jdbc:oracle:thin:@localhost:1521";
	String dbName = ":orcl";
	String driver = "oracle.jdbc.driver.OracleDriver";
	String userName = "scott"; 
	String password = "tiger";

	public void openConnection() throws Exception{

		try{
		Class.forName(driver).newInstance();
		}catch(ClassNotFoundException e){
		e.printStackTrace();
		}	
		try{
			conn = DriverManager.getConnection(url+dbName,userName,password);
			st=conn.createStatement();
		}catch(SQLException e){
			e.printStackTrace();
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	public void closeConnection(){
		try{
			if(conn!=null)
			conn.close();
		}catch(SQLException e){
			e.printStackTrace();
		}
	}
}